package com.potenza.business.service.impl;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.NoSuchElementException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.potenza.business.mapper.PmsBrandMapper;
import com.potenza.business.domain.PmsBrand;
import com.potenza.business.service.IPmsBrandService;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 品牌Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-20
 */
@Service
public class PmsBrandServiceImpl implements IPmsBrandService 
{
    @Autowired
    private PmsBrandMapper pmsBrandMapper;

    /**
     * 查询品牌
     * 
     * @param brandId 品牌主键
     * @return 品牌
     */
    @Override  //默认 RuntimeException 回滚
    @Transactional(isolation = Isolation.REPEATABLE_READ,
            rollbackFor = {SQLException.class},
            noRollbackFor = {FileNotFoundException.class},
            timeout = 1000,
            propagation = Propagation.REQUIRED
    )
    public PmsBrand selectPmsBrandByBrandId(Long brandId)
    {
        return pmsBrandMapper.selectPmsBrandByBrandId(brandId);
    }
    @Transactional(isolation = Isolation.REPEATABLE_READ,
            rollbackFor = {SQLException.class},
            noRollbackFor = {FileNotFoundException.class},
            timeout = 1000,
            propagation = Propagation.REQUIRES_NEW
    )

    /**
     * 查询品牌列表
     * 
     * @param pmsBrand 品牌
     * @return 品牌
     */
    @Override
    public List<PmsBrand> selectPmsBrandList(PmsBrand pmsBrand)
    {
        System.out.println("-----------===================");
        return pmsBrandMapper.selectPmsBrandList(pmsBrand);
    }

    /**
     * 新增品牌
     * 
     * @param pmsBrand 品牌
     * @return 结果
     */
    @Override
    public int insertPmsBrand(PmsBrand pmsBrand)
    {
        return pmsBrandMapper.insertPmsBrand(pmsBrand);
    }

    /**
     * 修改品牌
     * 
     * @param pmsBrand 品牌
     * @return 结果
     */
    @Override
    public int updatePmsBrand(PmsBrand pmsBrand)
    {
        return pmsBrandMapper.updatePmsBrand(pmsBrand);
    }

    /**
     * 批量删除品牌
     * 
     * @param brandIds 需要删除的品牌主键
     * @return 结果
     */
    @Override
    public int deletePmsBrandByBrandIds(Long[] brandIds)
    {
        return pmsBrandMapper.deletePmsBrandByBrandIds(brandIds);
    }

    /**
     * 删除品牌信息
     * 
     * @param brandId 品牌主键
     * @return 结果
     */
    @Override
    public int deletePmsBrandByBrandId(Long brandId)
    {
        return pmsBrandMapper.deletePmsBrandByBrandId(brandId);
    }
}
